-
Notifications
You must be signed in to change notification settings - Fork 71
fix(agent): fix potential memleak when calling newrelic_end_transaction(true) #1072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1072 +/- ##
=======================================
Coverage 78.11% 78.12%
=======================================
Files 193 193
Lines 27991 27999 +8
=======================================
+ Hits 21866 21875 +9
+ Misses 6125 6124 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5deff4d
to
e953a97
Compare
agent/php_mysqli.h
Outdated
* Purpose : Frees reference incremented, transaction global zvals | ||
* that must be cleaned up prior to postdeactivate | ||
*/ | ||
extern void nr_mysqli_rshutdown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a naming convention that symbols that are PHP runtime aware and are defined in the agent have the prefix of nr_php_
and the functions that are agnostic of PHP runtime and are defined in axiom have the prefix of nr_
. This convention helps in reasoning about the code when reading it. Please update the name of this function to nr_php_mysqli_rshutdown
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed in 5b8dd71
agent/php_pdo.h
Outdated
* Purpose : Frees reference incremented, transaction global zvals | ||
* that must be cleaned up prior to postdeactivate | ||
*/ | ||
extern void nr_pdo_rshutdown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a naming convention that symbols that are PHP runtime aware and are defined in the agent have the prefix of nr_php_
and the functions that are agnostic of PHP runtime and are defined in axiom have the prefix of nr_
. This convention helps in reasoning about the code when reading it. Please update the name of this function to nr_php_pdo_rshutdown
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed in 5b8dd71
Some transaction globals were leaked when calling
newrelic_end_transaction(true)
. The freeing of these transaction globals has been moved to join all the other transaction globals to alleviate this.In so doing, additional rshutdown methods are needed. This is because the transaction globals contain reference incremented zvals. If we wait until postdeactivate, those zvals will be in an undefined state and the data structures containing those references cannot be properly freed. In line with other transaction globals, we trigger a shutdown method during rshutdown to free these globals while the zvals are still valid.